# -*- coding = utf-8 -*-
# @Time : 2021/7/15 9:45
# @Author : 龙王赘婿_彪少
# @File : testBs41.py
# @Software: PyCharm

from bs4 import BeautifulSoup

file = open("./baidu.html", "rb")
myhtml = file.read().decode("utf-8")

#解析器 变成树结构
bs = BeautifulSoup(myhtml, "html.parser")

#文档的遍历 返回列表(超级数组)
print(bs.head.contents)
print(bs.head.contents[1])
